import matplotlib.pyplot as plt
import pandas as pd
import numpy as np

plt.rcParams['font.sans-serif'] = ['STHeiti', 'PingFang SC', 'Heiti TC', 'Microsoft YaHei', 'SimHei', 'Arial Unicode MS']  
plt.rcParams['axes.unicode_minus'] = False

df = pd.read_csv("data-8.csv")

# 提取年份列表
years = ["2025", "2030", "2035", "2040", "2045", "2050"]

# 定义模式和对应的中文标题
modes = ["随到随充", "有序充电", "车网互动"]


fig, axes = plt.subplots(1, 3, figsize=(11, 3.5))
# fig.suptitle(f"{base_scene_label} vs {scene_to_compare}", fontsize=16)

for ax, mode, suffix in zip(axes, modes, ["-UC", "-V1G", "-V2G"]):
    subset = df[df["模式"] == mode]
    baseline = subset[subset["场景"] == "低碳价格"][years].values.flatten() / 10
    compare = subset[subset["场景"] == "高碳价格"][years].values.flatten() / 10

    ax.scatter(years, baseline, marker='^', label=f"BAU-LOW{suffix}", color="black")
    ax.scatter(years, compare, marker='x', label=f"BAU-HIGH{suffix}", color="red")
    ax.set_xlabel("Year")
    ax.set_ylabel("CO2 Emissions (100M tons)")
    ax.legend()
    ax.set_ylim(0,4)
    ax.set_yticks(np.arange(0, 4.1, 0.8))

plt.tight_layout()
plt.savefig("8.jpg", dpi=400)
